package org.gao.test.transaction.web.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class InvocationHandlerImpl implements InvocationHandler{

	private Object object;
	
	public InvocationHandlerImpl(Object object) {
		this.object = object;
	}
	
	public Object invoke(Object proxy, Method method, Object[] args) {
		
		Object result = null;
		try {
			System.out.println("before do");
			
			result = method.invoke(object, args);
			
			System.out.println("after do");
			
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		}
		
		return result;
	}
	
}
